import { Stack } from "expo-router"
import { View,Text } from "react-native"
import { defaultStyles } from "@/styles"
import { ScrollView } from "react-native-gesture-handler"
import { screenPadding } from "@/constants/tokens"
import { TracksList } from "@/components/TracksList"
import library from '@/assets/data/library.json'
import { useNavigationSearch } from "@/hooks/useNavigationSearch"
import { useMemo } from "react"


const FavoritesScreen = () => {
	const search = useNavigationSearch({
		searchBarOptions: {
			placeholder: '搜索歌曲'
		}
	})
	const favoritetTacks = useMemo(() => {
	
			return library.filter((track) =>track.rating == 1 );
	}, [])
	return (
		<View style={defaultStyles.container}>
            <ScrollView 
			contentInsetAdjustmentBehavior="automatic"
			style={{
				paddingHorizontal: screenPadding.horizontal
			}}>
				<TracksList scrollEnabled={false} tracks={favoritetTacks} />

			</ScrollView>
		</View> 
	)
}

export default FavoritesScreen;